const themeSwitchListener = []
export default {

    addThemeSwitchListener(listener) {
        themeSwitchListener.push(listener)
    },

    removeThemeSwitchListener(listener) {
        let len = themeSwitchListener.length;
        for (let i = 0; i < len; i++) {
            if (themeSwitchListener[i] == listener) {
                themeSwitchListener.splice(i, 1)
                return;
            }
        }
    },

    dispatchThemeSwitchListener(theme) {
        let len = themeSwitchListener.length;
        for (let i = 0; i < len; i++)  themeSwitchListener[i](theme)
    },
}